﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;

public partial class buyerPayment : System.Web.UI.Page
{
    CommonPage cm3 = new CommonPage();
    VLGDataContext _db8 = new VLGDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["currentItem"] = "yoursp";
        if (!IsPostBack)
        {
            Page.Title = "Trang cá nhân | Các thanh toán - chuyển khoản bạn đã thực hiện";
            if (cm3.IsAuthenticated == false)
            {
                Response.Redirect(ResolveClientUrl("~/accessDenied.aspx"));
            }
            else
            {
                fillDulieuLenGrid();
            }
        }
    }

    void fillDulieuLenGrid()
    {
        int idUs = cm3.Customer.idAcc;
        var gigCanhan = from gg2 in _db8.YeuCauChuyenKhoans
                        where gg2.idAcc == idUs && (gg2.type == (int)EnumChuyenKhoanType.MuaTK || gg2.type == (int)EnumChuyenKhoanType.MuaPP) && (gg2.status == true)
                        orderby gg2.ngay descending
                        select gg2;
        GridView1.DataSource = gigCanhan;
        GridView1.DataBind();
    }
    //protected void linkAdd_Click(object sender, EventArgs e)
    //{

    //    Response.Redirect(ResolveClientUrl("~/qlcongviec.aspx?op=add"));
    //}
    //protected void linkDelG_Click(object sender, EventArgs e)
    //{
    //    try
    //    {
    //        string lDel = ((LinkButton)sender).CommandArgument.ToString();
    //        string tenhinh = "";
    //        Gig giDel = _db8.Gigs.Single(iiiid => iiiid.idGig == int.Parse(lDel));
    //        tenhinh = giDel.UrlHinh1;
    //        _db8.Gigs.DeleteOnSubmit(giDel);
    //        _db8.SubmitChanges();

    //        // Xoa hinh tren host
    //        string urlIMG = Server.MapPath("~/upload/") + tenhinh;
    //        string urlIMGThum = Server.MapPath("~/upload/thumnails/") + tenhinh;
    //        File.Delete(urlIMG);
    //        File.Delete(urlIMGThum);
    //        this.fillDulieuLenGrid();
    //    }
    //    catch
    //    {
    //        this.fillDulieuLenGrid();
    //        Literal1.Text = "<script type=\"text/javascript\">" +
    //                            "$(function() { " +
    //                            "alert(\"Không thể xóa công việc này. Vì đang có đơn đặt hàng.\");" +
    //                            "});" +
    //                            "</script>";
    //    }
    //}
    //protected void linkEditG_Click(object sender, EventArgs e)
    //{

    //}
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {

    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {

    }
    protected void btnTiep2_Click(object sender, EventArgs e)
    {
        string noidung = TextBox1.Text.ToString().Trim();
        Response.Redirect(ResolveClientUrl("~/qlcongviec.aspx?op=add&to=") + noidung);
    }
}
